const INFO_KEY = 'luohz_shopping'
const HISTORY_KEY = 'luohz_history_list'
export const getInfo = () => {
  const defaultObj = {
    token: '',
    userId: ''
  }
  const result = localStorage.getItem(INFO_KEY)
  return result ? JSON.parse(result) : defaultObj
}

export const setInfo = (obj) => {
  localStorage.setItem(INFO_KEY, JSON.stringify(obj))
}
export const remInfo = () => {
  localStorage.removeItem(INFO_KEY)
}

export const getHistorys = () => {
  const result = localStorage.getItem(HISTORY_KEY)
  return result ? JSON.parse(result) : []
}

export const setHistorys = (obj) => {
  localStorage.setItem(HISTORY_KEY, JSON.stringify(obj))
}
